package cn.com.bod.fas.common.constant.enumconst;

/**
 * @description 响应报文返回码枚举值
 * @author chenyuanxian
 * @date 2019年9月15日 下午6:12:50
 * @version 1.0.0
 * @Copyright (c) scfhdt
 */

public enum ResultCodeEnum {

    SUCCESS(0, "成功"),
    ERROR(-1, "系统业务繁忙，请您稍后再试，谢谢！"),
    HYSTRIX_ERROR(-2, "请求被熔断"),

    USER_NOT_FIND(101, "用户不存在"),
    USER_NAME_OR_PASSWORD_ERROR(102, "用户名或密码错误"),
    USER_NOT_LOGIN(103, "用户未登陆"),

    CUSTOMER_SERVICE_ERROR(10000000, "客户中心服务异常"),


    PLEDGE_SERVICE_ERROR(11000000, "押品管理中心服务异常"),

    PLDGE_CAN_NOT_DELETE(11001001, "押品已入库不允许删除！"),

    PLDGE_NOT_EXIST(11001002, "押品不存在！"),


    PROP_CAN_NOT_DELETE(11002001, "权证已入库不允许删除！"),

    PROP_NOT_EXIST(11002002, "权证不存在！"),

    
    PRODUCT_SERVICE_ERROR(12000000, "产品管理服务异常"),
    
    PRODUCT_SERVICE_NO_FEE_ERROR(12000001,"产品管理服务-该产品未配置费用"),
    PRODUCT_SERVICE_FEE_ERROR(12000002,"产品管理服务-费用配置异常"),
    PRODUCT_SERVICE_PROD_ELEM_ERROR(12010001,"产品管理服务-该产品未配置"),
    
    CONTRACT_SERVICE_ERROR(13000000, "合同管理服务异常"),
    
    LOANFLOW_SERVICE_ERROR(14000000, "贷款流程管理服务异常"),

    LOANFLOW_SERVICE_ECHAIN_ERROR(14010001,"流程引擎服务异常"),
    NODESIGN_ERROR(14010002,"节点标识输入有误"),
    APPLY_INFO_EXIST_ALREADY(14001001,"申请信息已存在"),
    APPLY_INFO_NOT_EXIST(14001002,"申请信息不存在"),
    APPLY_INFO_CAN_NOT_NULL(14001003,"申请信息不能为空"),
    APPLY_NO_CAN_NOT_NULL(14001004,"申请编号不能为空"),
    APPLY_PER_INFO_NOT_NULL(14001005,"申请人信息不完整，不能提交"),
    APPLY_CUST_NO_NOT_NULL(14001006,"客户编号不能为空"),
    LOAN_APPLY_CAN_NOT_DELETE(14001007,"贷款申请已提交不允许删除"),

    
    PAYMENT_SERVICE_ERROR(15000000, "支付中心服务异常"),
    
    IMAGE_SERVICE_ERROR(16000000, "影像平台服务异常"),
    
    DEALER_SERVICE_ERROR(17000000, "供应商中心服务异常"),
    
    AGGREGATION_SERVICE_ERROR(18000000, "聚合平台服务异常"),
    
    OUTACCESSGATEWAY_SERVICE_ERROR(19000000, "接出网关服务异常"),
    
    USEDCAR_SERVICE_ERROR(20000000, "二手车场景服务异常"),
    USED_CAR_FIN_CODE(20001001, "该车辆已被融资"),
    
    BAFFLE_SERVICE_ERROR(21000000, "挡板服务异常"),



    HTTP_REQUEST_METHOD_NOT_SUPPORTED(1000, "不支持当前请求方法"),
    HTTP_MEDIA_TYPE_NOT_SUPPORTED(1001, "不支持当前媒体类型"),
    PARAM_RESLOVE_FAIL(1002, "参数解析失败"),
    PARAM_VALIDATION_ERROR(1003, "参数错误"),
    VALID_CODE_ERROR(1004, "验证码错误"),
    TOKEN_ERROR(1005, "token错误"),
    TOKEN_OVERDUE(1006, "token已失效"),
    UPLOAD_FILE_EXCEED_MAX_SIZE(1007, "上传文件失败，文件大小不能超过："),

    NOT_EXIST_HEAD_LOGIN_ID(1008, "用户编码请求头不存在"),
    NOT_EXIST_HEAD_SING(1009, "参数签名请求头不存在"),
    NOT_EXIST_HEAD_REQUEST_ID(1010, "请求ID请求头不存在"),
    NOT_EXIST_HEAD_USER_TYPE(1011, "请求用户类型请求头不存在"),
    NOT_EXIST_HEAD_CHANNEL_TYPE(1012, "请求渠道类型请求头不存在"),
    NOT_EXIST_SEQ_CODE(1013, "错误的序列ID"),
    NOT_EXIST_HEADER_TOKEN(1014, "访问令牌请求头不存在"),
    NOT_EXIST_HEADER_TIMESTAMP(1015, "客户端发起请求时间戳请求头不存在");


    private Integer code;

    private String msg;

    ResultCodeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
    
    /**
     * @description 获取响应报文返回码枚举值
     * @author chenyuanxian
     * @date 2019年9月25日 下午3:23:19
     * @param code
     * @return 响应报文返回码枚举值
     */
    public static ResultCodeEnum codeOf(int code) {
        for (ResultCodeEnum resultCodeEnum : values()) {
            if (resultCodeEnum.getCode() == code) {
                return resultCodeEnum;
            }
        }
        return null;
    }
    
    /**
     * @description 获取响应报文返回码枚举值中文描述
     * @author chenyuanxian
     * @date 2019年9月25日 下午3:24:37
     * @param code
     * @return
     */
    public static String valueOf(int code) {
        for (ResultCodeEnum resultCodeEnum : values()) {
            if (resultCodeEnum.getCode() == code) {
                return resultCodeEnum.getMsg();
            }
        }
        return "";
    }

}
